<?php
  
  /**
   * Classe album
   */
  class Album {
    public $id=0;
    public $name=""; 
    public $description=""; 
    public $img_enavant_id; 
    
    
    function __construct() {

    }
    
    
    /**
     * Retourne l'id de cette image
     */
    public function getId() {
    	return $this->id;
    }

    /**
     * Retourne le nom de cette album
     */
    public function getName() {
    	return $this->name;
    }

    /**
     * Retourne le nom de cette album
     */
    public function getDescription() {
    	return $this->description;
    }
    
    /**
     * Modifie le nom de cette album
     */
    public function setName($name) {
    	$this->name = $name;
    }
    public function getImages($ctr) {
    	return $ctr->getImageDAO()->getImageByAlbum($this);
    }
    
    public function getImageEnAvant($ctr) {
    	if($this->img_enavant_id!=null){
    		return $ctr->getImageDAO()->getImage($this->img_enavant_id);
    	}else{
    		return null;
    	}
    }
    public function getImageEnAvantUrl($ctr) {
    	$img=$this->getImageEnAvant($ctr);
    	if($img!=null){
    		return ImageDAO::getUrlPath()."/".$img->getPath();
    	}else{
    		return dirname($_SERVER['REQUEST_URI']) ."/images/albumDefault.png";
    	}
    }
    
   

  }
  
  
?>